package com.bt.dmdb.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "ODS_REGION")
@SuppressWarnings("serial")
public class Region implements java.io.Serializable {

    private long id;
    private String name;
    private Set<SubRegion> subRegions = new HashSet<SubRegion>(0);
    private Set<User> users = new HashSet<User>(0);

    public Region() {
    }

    public Region(long id, String name) {
        this.id = id;
        this.name = name;
    }

    public Region(long id, String name, Set<SubRegion> subRegions, Set<User> users) {
        this.id = id;
        this.name = name;
        this.subRegions = subRegions;
        this.users = users;
    }

    @Id
    @Column(name = "ID", unique = true, nullable = false, precision = 10, scale = 0)
    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Column(name = "NAME", nullable = false, length = 50)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "region")
    public Set<SubRegion> getSubRegions() {
        return this.subRegions;
    }

    public void setSubRegions(Set<SubRegion> subRegions) {
        this.subRegions = subRegions;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "region")
    public Set<User> getUsers() {
        return this.users;
    }

    public void setUsers(Set<User> users) {
        this.users = users;
    }
}
